package com.ht.utils.htmlBean;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 表格的线属性
 */
@Data
@AllArgsConstructor
public class Line {
    private String type;
    private String color;
    private float sz;
    private float space;
    public String toHtml(){
        StringBuilder html = new StringBuilder();
        if(this.type!=null){
            html.append("border-style:").append(converLineType(this.type)).append(";");
        }
        if(this.color!=null&&!this.color.equals("auto")){
            html.append("border-color:").append(this.color).append(";");
        }
        return html.toString();
    }

    static String converLineType(String wordType){
        String htmlType = wordType;
        if (wordType.equals("single")) {
            htmlType = "solid";
        }
        return htmlType;
    }

    static String converColor(String wordColor){
        if("#auto".equals(wordColor)){
            return "#000000";
        }else {
            return wordColor;
        }
    }

}
